﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Linq;

namespace JuCloudy.Data.Nhibernate.App.Toursim
{
    public class ContentContainer
    {
        /*private static global::NHibernate.Cfg.Configuration mCfg = null;
        private static global::NHibernate.ISessionFactory SessionFactory = null;*/
        private AppContainer<JuCloudy.Data.Entity.AppToursimContent> appcontainer{get;set;}

        public ContentContainer()
        {
           /* mCfg = new NHibernate.Cfg.Configuration().Configure(
               System.Web.HttpContext.Current.Server.MapPath(
                    System.Configuration.ConfigurationManager.AppSettings["AppToursimNhCfg"]
                    ));

            SessionFactory = null;

            mCfg.AddClass(typeof(JuCloudy.Data.Entity.AppToursimContent));
            SessionFactory = mCfg.BuildSessionFactory();*/
        }
        public List<Entity.AppToursimContent> Insert(Entity.AppToursimContent Entity)
        {
            Entity.CreateDate = DateTime.Now;
            appcontainer=new AppContainer<Entity.AppToursimContent>("AppToursimNhCfg");
            return appcontainer.Insert(Entity);
        }

        public List<Entity.AppToursimContent> Delete(Entity.AppToursimContent Entity)
        {
            appcontainer = new AppContainer<Entity.AppToursimContent>("AppToursimNhCfg");
            return appcontainer.Delete(Entity);
        }

        public Entity.AppToursimContent GetEntity(string Query)
        {
            appcontainer = new AppContainer<Entity.AppToursimContent>("AppToursimNhCfg");
            return appcontainer.GetEntity("ContentId",Query);
        }

        public List<Entity.AppToursimContent> GetEntities()
        {
            appcontainer = new AppContainer<Entity.AppToursimContent>("AppToursimNhCfg");
            return appcontainer.GetEntities();
        }
    }
}
